import request from "@/utils/request";
import Cookies from "js-cookie";

// 登录方法
export function login(username, password, code, uuid) {
    const data = {
        username,
        password,
        code,
        uuid
    }

    return request({
        url: '/sys/login/doLogin',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

export function getCaptcha() {
    return request({
        url: `sys/captcha/getCaptcha`,
        headers: {
            isToken: false
        },
        method: 'get'
    })
}

export function logout() {
    const userId = Cookies.get('user_id');
    return request({
        url: 'sys/login/logout/' + userId,
        headers: {
            isToken: false
        },
        method: 'post'
    })
}